package state.example;

/**
 * 晚上工作状态
 * @author Chen Guang
 * @date 2019/4/16 0016 上午 10:36
 */
public class EveningStateImpl implements State{
    @Override
    public void writeProgram(Work work) {
        if(work.isTaskFinished()){
            work.setCurrent(new RestStateImpl());
            work.writeProgram();
        }else {
            if(work.getHour() < 21){
                System.out.println("当前时间："+ work.getHour() +",加班哦，疲惫至极。");
            }else {
                work.setCurrent(new SleepingStateImpl());
                work.writeProgram();
            }
        }
    }
}
